package com.dliu.javadesign.create.factory.pattern;

import com.dliu.javadesign.create.factory.normal.RequestVo;
import com.dliu.javadesign.create.factory.pattern.impl.CouponImpl;
import com.dliu.javadesign.create.factory.pattern.impl.GoodsImpl;
import com.dliu.javadesign.create.factory.pattern.impl.VIPImpl;

/**
 * 创建工厂
 * @author yanglei
 * date 2021/3/26 15:58
 */
public class AwardFactory {

    public IAward getAward(Integer type){
        switch (type){
            case 1: return new CouponImpl();
            case 2: return new GoodsImpl();
            case 3: return new VIPImpl();
            default: return null;
        }
    }

    public static void main(String[] args) {
        AwardFactory awardFactory = new AwardFactory();
        awardFactory.getAward(2).send2User(new RequestVo().setUserId(123L).setAddr("成都"));
    }
}
